import {
  businessTypeMap,
  businessLevelMap,
  bussinessStatusMap
} from '@/config/dict'
import { CustomStatus } from '@/components'

export const queryFormItem = [
  {
    type: 'select',
    key: 'business_type',
    // label: '业务类型',
    options: businessTypeMap,
    otherAttrs: {
      style: {
        width: '110px'
      },
      placeholder: '业务类型'
    }
  },
  {
    type: 'select',
    key: 'business_level',
    // label: '业务级别',
    options: businessLevelMap,
    otherAttrs: {
      style: {
        width: '110px'
      },
      placeholder: '业务级别'
    }
  },
  {
    type: 'select',
    key: 'status',
    // label: '状态',
    options: bussinessStatusMap,
    otherAttrs: {
      style: {
        width: '110px'
      },
      placeholder: '状态'
    }
  },
  {
    type: 'input',
    key: 'name',
    // label: '业务名称'
    otherAttrs: {
      style: {
        width: '160px'
      },
      placeholder: '业务名称'
    }
  }
]

export const tableColumn = (handleTrigger, handleFeedback) => {
  return [
    {
      key: 'name',
      label: '业务名称',
      minWidth: 160
      // render: (h, scope) => <el-button size='small' type='text' value={scope.row.status} />
    },
    {
      key: 'businessType',
      label: '业务类型',
      minWidth: 100
    },
    {
      key: 'now',
      label: '当前预警',
      minWidth: 100
    },
    {
      key: 'businessLevel',
      label: '业务级别',
      minWidth: 100
    },
    {
      key: 'role',
      label: '考核部门',
      minWidth: 160
    },
    {
      key: 'platform',
      label: '平台触发',
      minWidth: 120,
      render: (h, scope) => <el-button size='small' type='text' onClick={() => handleTrigger(scope.row)} >点击查看</el-button>
    },
    {
      key: '',
      label: '执行反馈',
      minWidth: 120,
      render: (h, scope) => <el-button size='small' type='text' onClick={() => handleFeedback(scope.row)} >点击查看</el-button>
    },
    {
      key: 'status',
      label: '状态',
      minWidth: 100,
      render: (h, scope) => <CustomStatus list={bussinessStatusMap} value={scope.row.status} />
    }
  ]
}

export const updateFormItem = disabled => {
  return [
    {
      type: 'input',
      key: 'edisCode',
      label: '姓名',
      col: 24,
      slotAttrs: {
        style: {
          width: '40%'
        }
      }
    },
    {
      type: 'input',
      key: 'deviceCode',
      label: '账号',
      col: 24,
      slotAttrs: {
        style: {
          width: '40%'
        }
      }
    },
    {
      type: 'select',
      key: 'status',
      label: '所属角色',
      col: 24,
      slotAttrs: {
        style: {
          width: '40%'
        }
      }
    },
    {
      type: 'select',
      key: 'recurPeriod',
      label: '所在地',
      col: 24,
      slotAttrs: {
        style: {
          width: '40%'
        }
      }
    },

    {
      type: 'select',
      key: '',
      label: '所属部门',
      col: 24,
      slotAttrs: {
        style: {
          width: '40%'
        }
      }
    },
    {
      type: 'radio',
      key: 'data',
      label: '数据权限',
      col: 24,
      slotAttrs: {}
    }
  ]
}
